package com.itheima.test4;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.nio.charset.Charset;

/**
 * @Author:gy
 * @Date: 2025/08/31 14:46
 * @Description:
 */
public class demo4 {
    public static void main(String[] args) throws Exception {
        FileReader fr = new FileReader("D:\\班级\\93期\\day11-IO\\a.txt", Charset.forName("GBK"));
        int ch;
        while ((ch = fr.read()) != -1) {
            System.out.print((char) ch);
        }
        fr.close();
        FileWriter fw = new FileWriter("D:\\班级\\93期\\day11-IO\\a.txt", Charset.forName("GBK"));
        fw.write("你好世界");
        fw.close();
    }
}
